<?php
require_once(".././controller/usuario.php");

session_start();

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" 
  "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>
	  menu
	</title>
    <link rel="Stylesheet" href="./css/sisconc.css" type="text/css" />
    <script type="text/javascript" src="./js/sisconc.js">
    </script>
  </head>
  <body>
    <div class="box">
    <form method="post" action="<?php $_SERVER['PHP_SELF']?>">
	    <fieldset>
		  <legend>
		    <img src="./img/logo.jpg" alt="logotipo" />
		  </legend>
            <select name="cpf" tabindex="3" >
<?php
$banco = new BANCO();
				
$vetortemporario = $banco->ExecutaSQL("SELECT cpf, nome FROM usuario ORDER BY nome;");
for($x = 0; $x < $banco->RetornaQuantidadeLinhas() ; $x++) 
  {
  echo "              <option value=\"" . $vetortemporario[$x][0] .  "\">" . $vetortemporario[$x][0] . " --- " . $vetortemporario[$x][1] . "</option>\n";   
  }
unset($banco);
?>
            </select>
			<br /><input type="submit" name="Submit" value="Listar" />
			<br />
<?php

if(!(empty($_POST['cpf'])))
  {
  $banco2 = new BANCO();
				
  $sql2 = "SELECT usuario.cpf, usuario.nome, usuario_departamento.funcao FROM usuario, usuario_departamento WHERE usuario.cpf='" . $_POST['cpf'] . "' AND usuario.cpf=usuario_departamento.cpf_usuario;";
  $vetortemporario2 = $banco2->ExecutaSQL($sql2);
  for($x = 0; $x < $banco2->RetornaQuantidadeLinhas() ; $x++) 
    {
	echo "<div class=\"box1\">";
    echo "CPF:" . $vetortemporario2[$x][0] . " --- Nome:" . $vetortemporario2[$x][1];
    if($vetortemporario2[$x][2] == 2)
	  {
	  echo " --- Fun&ccedil;&atilde;o: Gerente Financeiro"; 
	  }
    if($vetortemporario2[$x][2] == 3)
	  {
	  echo " --- Fun&ccedil;&atilde;o: Gerente Financeiro e Administrador"; 
	  }
    if($vetortemporario2[$x][2] == 4)
	  {
	  echo " --- Fun&ccedil;&atilde;o: Agente Financeiro"; 
	  }
    if($vetortemporario2[$x][2] == 5)
	  {
	  echo " --- Fun&ccedil;&atilde;o: Agente Financeiro e Administrador"; 
	  }	  
	  
	echo "</div>";
    }
  unset($banco2);
  }
?>
  
		  <br />
            <a href="usuario.php">voltar</a><br />
        </fieldset>		
    </form>
  </body>
</html>
